<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Rate extends MY_Controller {
	
	public function __construct()
	{
		parent::__construct();
		$this->load->model('rate_model');	
	}
	
	public function company($com)
	{
		$data['user_id'] = $this->session->userdata['user_id'];
		$data['company_id'] = $com;
		$data['rate'] = $this->input->post('rating');
		
		$result = $this->rate_model->company($data);
		$this->log('Rate', 'Vote for Company with ID: '.$com.' : '.$this->session->userdata['ip_address']);
		die($result);
	}
	
	public function contact($contact)
	{
		$data['user_id'] = $this->session->userdata['user_id'];
		$data['contact_id'] = $contact;
		$data['rate'] = $this->input->post('rating');
		
		$result = $this->rate_model->contact($data);
		$this->log('Rate', 'Vote for Contact with ID: '.$contact.' : '.$this->session->userdata['ip_address']);
		die($result);
	}
}

